home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
st80_pr4.lha
/
st80_pre4
/
WindowMaker
/
WMExtras.pp.1
< prev
next >
Wrap
Text File
|
1993-07-24
|
3KB
|
73 lines
"Copyright WilfLalonde, The Object People"!
Smalltalk garbageCollect!
!DisplayObject methodsFor: 'screen'!
slideFrom: startPoint to: stopPoint steps: steps
"Displays at all points except the first."
| i point delta |
i _ 0. point _ startPoint. delta _ (stopPoint - startPoint) // steps.
^self follow: [point _ point + delta] while: [(i _ i+1) < steps]! !
!Collection methodsFor: 'private'!
maxPrint
"Answer the maximum number of characters to print with printOn:."
^10000! !
!MethodNode methodsFor: 'code generation'!
generateAt: aRemoteString
"MODIFIED by replacing 4 occurrences of 'self error: ...' by 'encoder notify: ...'."
"I am the root of a parse tree; answer with an instance of CompiledMethod."
| blkSize method nLits stack strm nArgs primn |
self generateIfQuick:
[:meth |
meth setSourcePosition: aRemoteString.
meth cacheTempNames: self tempNames.
^meth].
nArgs _ arguments size.
blkSize _ block sizeForEvaluatedValue: encoder.
primn _ (primitive < 256) & (primitive > -256) ifTrue: [primitive] ifFalse: [0].
literals _ encoder literals: primn nArgs: nArgs.
encoder maxTemp > 31
ifTrue: [^encoder notify: 'Too many temporary variables'].
(nLits _ literals size) > 255
ifTrue: [^encoder notify: 'Too many literals referenced'].
method _ CompiledMethod "Dummy to allocate right size"
newBytes: blkSize + CompiledMethod bytesForSource
flags: ((nArgs <= 4 and: [primn = 0]) ifTrue: [nArgs] ifFalse: [7])
nTemps: encoder maxTemp
nStack: 0
nLits: nLits.
strm _ ReadWriteStream with: method.
strm position: method initialPC - 1.
stack _ ParseStack new init.
block emitForEvaluatedValue: stack on: strm.
stack position ~= 1 ifTrue: [^encoder notify: 'Compiler stack discrepancy'].
strm position ~= (method size - CompiledMethod bytesForSource)
ifTrue: [^encoder notify: 'Compiler code size discrepancy'].
1 to: nLits do: [:lit | method literalAt: lit put: (literals at: lit)].
method needsStack: stack size encoder: encoder.
method setSourcePosition: aRemoteString..
method cacheTempNames: self tempNames.
^method! !
!Parser methodsFor: 'public access'!
parse: sourceStream class: class noPattern: noPattern context: ctxt
notifying: req ifFail: aBlock
"MODIFIED not to destroy the requestor or fail block."
"Answer with a parse tree. noPattern is true for doIts (Compiler evaluate)"
| meth |
self init: sourceStream notifying: req failBlock: [^aBlock value].
encoder _ Encoder new init: class context: ctxt notifying: self.
failBlock_ aBlock.
meth _ self method: noPattern context: ctxt.
encoder _ "failBlock _ requestor _" parseNode _ nil. "break cycles & mitigate refct overflow"
^meth! !